#!/usr/bin/python

def insertion_sort(list):
	for index in range(1, len(list)):
		value = list[index]
		i = index - 1          # i is the item right on the left side where we can compare to. 
		while i >= 0:	
			if value < list[i]: # if < then move the value to the left and move list[i] to the right
				list[i+1] = list[i]
				list[i] = value
				i = i - 1
			else:
				break
	return list

a = [7,1,3,5,9,2,3]
print insertion_sort(a)
